package com.example.smartmallserver.demos.web.controller;

import com.example.smartmallserver.demos.web.pojo.Validate;
import com.example.smartmallserver.demos.web.service.CaptchaService;
import com.example.smartmallserver.demos.web.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

//@CrossOrigin
@RestController
public class CaptchaController {
    @Autowired
    CaptchaService captchaService;
    //生成图片验证码
    @GetMapping("/captcha/image")
    Result captcha(){
        Validate data = captchaService.createCaptcha();
        return Result.success(data);
    }

    //生成短信验证码
    @GetMapping("/captcha/sendSmsCaptcha")
    Result sendSmsCaptcha(){
        String key = "246810";
        System.out.println(key);
        return Result.success(key);
    }
}
